﻿using JavaCodeGeneratorConsole.utils;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace JavaCodeGeneratorConsole.entity
{
    public class TableColunm
    {
        public int cid { get; set; }
        public string name { get; set; }
        public string javaName { get; set; }
        public string bigName { get; set; }
        public string type { get; set; }
        public string javaType { get; set; }
        public int pk { get; set; }

        public void Update()
        {
            javaName = StringUtils.RenameCamelCase(StringUtils.SnakeRenameCase(name));
            bigName = StringUtils.SnakeRenameCase(name);
            string tDbType = type.ToLower();
            //Console.WriteLine(tDbType);
            if (tDbType == "integer")
            {
                javaType = "Integer";
            }
            if (tDbType == "real")
            {
                javaType = "Double";
            }
            if (tDbType == "text")
            {
                javaType = "String";
            }
            if (tDbType == "numeric")
            {
                javaType = "BigDecimal";
            }
            if (tDbType == "date")
            {
                javaType = "Date";
            }
            if (tDbType == "timestamp")
            {
                javaType = "Date";
            }
        }

    }
}
